// TestPerf.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Perf/perf.h"
#include <iostream>
#include <string>

int _tmain(int argc, _TCHAR* argv[])
{
	PerfAutoInitialize();

	std::wcout << _T("CounterSet Name : ");

	std::wstring counterSetName;
	std::wcin >> counterSetName;

	std::wcout << _T("CounterSet ID : ");
	DWORD counterSetID = 0;
	std::wcin >> counterSetID;

	PPERF_COUNTERSET_INSTANCE instance = PerfCreateInstance(hDataSource_perf_1, &CtrSetGuid_perf_1_1, counterSetName.c_str(), counterSetID);
	
	while(1)
	{
		std::wcout << _T("quit if CounterID is 0") << std::endl;
		std::wcout << _T("CounterID : ");

		DWORD counterID = 0;
		std::wcin >> counterID;

		if (counterID == 0)
		{
			break;
		}

		std::wcout << _T("CounterValue : ");
		DWORD counterValue = 0;
		std::wcin >> counterValue;

		PerfSetULongCounterValue(hDataSource_perf_1, instance, counterID, counterValue);

		Sleep(1);
	}

	PerfAutoCleanup();
	return 0;
}
